using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PH_AMTMap : EntityTypeConfiguration<SO_PH_AMT>
    {
        public SO_PH_AMTMap()
        {
            // Primary Key
            this.HasKey(t => new { t.PHYSICIAN, t.PERCENTAGE, t.AMOUNT, t.Due_ON_GR_1, t.Due_on_Gr_2, t.Guarantor1__, t.Guarantor2__, t.SUMFIELDS, t.DIMFIELDS });

            // Properties
            this.Property(t => t.Bill__)
                .HasMaxLength(8);

            this.Property(t => t.PHYSICIAN)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.ITEM)
                .HasMaxLength(10);

            this.Property(t => t.Guarantor1__)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Guarantor2__)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Guarantor_1)
                .HasMaxLength(110);

            this.Property(t => t.Guarantor_2)
                .HasMaxLength(110);

            this.Property(t => t.PHYSICIAN_id)
                .HasMaxLength(10);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(32);

            this.Property(t => t.DIMFIELDS)
                .IsRequired()
                .HasMaxLength(45);

            // Table & Column Mappings
            this.ToTable("SO_PH_AMT");
            this.Property(t => t.Bill__).HasColumnName("Bill_#");
            this.Property(t => t.PHYSICIAN).HasColumnName("PHYSICIAN");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.PERCENTAGE).HasColumnName("PERCENTAGE");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.AMOUNT).HasColumnName("AMOUNT");
            this.Property(t => t.Due_ON_GR_1).HasColumnName("Due_ON_GR_1");
            this.Property(t => t.Due_on_Gr_2).HasColumnName("Due_on_Gr_2");
            this.Property(t => t.Guarantor1__).HasColumnName("Guarantor1_#");
            this.Property(t => t.Guarantor2__).HasColumnName("Guarantor2_#");
            this.Property(t => t.Guarantor_1).HasColumnName("Guarantor_1");
            this.Property(t => t.Guarantor_2).HasColumnName("Guarantor_2");
            this.Property(t => t.PHYSICIAN_id).HasColumnName("PHYSICIAN_id");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DIMFIELDS).HasColumnName("DIMFIELDS");
        }
    }
}
